package cn.flc.controller;




import cn.flc.bean.dto.UserDto;
import cn.flc.jsonresult.JSONResult;
import cn.flc.service.UserService;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;


/**
 * @author: Xzh
 * @date: 2023/3/3 15:54
 * @description:
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    //支持跨域
    @CrossOrigin
    @PostMapping("/register")
    public JSONResult register(@RequestBody UserDto user){
        JSONResult register = userService.register(user);
        return register;
    }
    @CrossOrigin
    @PostMapping("/login")
    @ResponseBody
    public JSONResult login2(@RequestBody UserDto user){
        //判断是否有账户
       return  userService.login(user);

    }
    @CrossOrigin
    @PostMapping("/remind")
    @ResponseBody
    public JSONResult remind(@RequestBody UserDto user){
        //判断是否有账户
        return  userService.remind(user);

    }
}
